package com.gqh.weather.config;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * MinIO配置类
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "minio")
public class MinioConfig {
    
    /**
     * MinIO服务地址
     */
    private String endpoint;
    
    /**
     * 用户名
     */
    private String accessKey;
    
    /**
     * 密码
     */
    private String secretKey;
    
    /**
     * 业务存储桶名称
     */
    private String bucketStudentFace;
    
    /**
     * 临时存储桶名称
     */
    private String temp;
    
    /**
     * 创建MinioClient Bean
     *
     * @return MinioClient实例
     */
    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(endpoint)
                .credentials(accessKey, secretKey)
                .build();
    }
}